load("//bazel:macros.bzl", "exports_files_legacy")
load("//bazel:cc_binary_with_flags.bzl", "cc_binary_with_flags")

licenses(["notice"])

exports_files_legacy()

cc_binary_with_flags(
    name = "hello_world_gl",
    testonly = True,
    srcs = [
        "HelloWorld.cpp",
        "HelloWorld.h",
    ],
    # These flags are defined in //bazel/common_config_settings/BUILD.bazel
    set_flags = {
        # Use the GL backend with the normal GL standard (as opposed to WebGL or GLES)
        "gpu_backend": [
            "gl_backend",
        ],
        "with_gl_standard": [
            "gl_standard",
        ],
        # Load fonts from the standard system directory (e.g. "/usr/share/fonts/")
        # as defined in //src/ports/SkFontMgr_custom_directory_factory.cpp
        "fontmgr_factory": [
            "custom_directory_fontmgr_factory",
        ],
    },
    deps = [
        "//:skia_public",
    ] + select({
        "@platforms//os:macos": ["//tools/sk_app:sk_app_objc"],
        "@platforms//os:linux": ["//tools/sk_app:sk_app"],
        "//conditions:default": [],
    }),
)

cc_binary_with_flags(
    name = "hello_world_vulkan",
    testonly = True,
    srcs = [
        "HelloWorld.cpp",
        "HelloWorld.h",
    ],
    # These flags are defined in //bazel/common_config_settings/BUILD.bazel
    set_flags = {
        "gpu_backend": [
            "vulkan_backend",
        ],
        # Load fonts from the standard system directory (e.g. "/usr/share/fonts/")
        # as defined in //src/ports/SkFontMgr_custom_directory_factory.cpp
        "fontmgr_factory": [
            "custom_directory_fontmgr_factory",
        ],
    },
    deps = [
        "//:skia_public",
        "//tools/sk_app",
    ],
)

cc_binary_with_flags(
    name = "hello_world_dawn",
    testonly = True,
    srcs = [
        "HelloWorld.cpp",
        "HelloWorld.h",
    ],
    # These flags are defined in //bazel/common_config_settings/BUILD.bazel
    set_flags = {
        "gpu_backend": [
            "dawn_backend",
        ],
        # Load fonts from the standard system directory (e.g. "/usr/share/fonts/")
        # as defined in //src/ports/SkFontMgr_custom_directory_factory.cpp
        "fontmgr_factory": [
            "custom_directory_fontmgr_factory",
        ],
    },
    deps = [
        "//:skia_public",
        "//tools/sk_app",
    ],
)

cc_binary_with_flags(
    name = "vulkan_basic",
    testonly = True,
    srcs = [
        "VulkanBasic.cpp",
    ],
    # These flags are defined in //bazel/common_config_settings/BUILD.bazel
    set_flags = {
        "gpu_backend": [
            "vulkan_backend",
        ],
    },
    deps = [
        "//:skia_public",
        "//include/third_party/vulkan",
        # This DEPS is for the utility in the demo for creating a vulkan context.
        # Outside clients would not need it.
        "//tools/gpu/vk:testutils",
    ],
)
